<!DOCTYPE html>
<html>
<head>
<title>basic example</title>
<meta charset="UTF-8">
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>


<script type="text/javascript" src="../jquery.qrcode.min.js"></script>
<!--
<script type="text/javascript" src="../src/jquery.qrcode.js"></script>
<script type="text/javascript" src="../src/qrcode.js"></script>
-->
<p>Render in table</p>
<div id="qrcodeTable"></div>
<p>Render in canvas</p>
<div id="qrcodeCanvas"></div>
<script>

function utf16to8(str) {
var out, i, len, c;
out = "";
len = str.length;
for (i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
};
	//jQuery('#qrcode').qrcode("this plugin is great");
	jQuery('#qrcodeTable').qrcode({
		render	: "table",
		text	: utf16to8("http://share.lrshuai.top?kw=|哈哈|新年|2018|")
	});	
	jQuery('#qrcodeCanvas').qrcode({
		render	: "table",
		text	: utf16to8("http://share.lrshuai.top?kw=|a|热|2018|"),
		width: 260, //宽度
		height: 260, //高度
		typeNumber: -1,//计算模式
		correctLevel: 2,//二维码纠错级别
		background: "#ffffff",//背景颜色
		foreground: "#000" //二维码颜色
	});	
	
	
</script>

</body>
</html>
